<?php

/**
 * This is the model class for table "other_safety_feature".
 *
 * The followings are the available columns in table 'other_safety_feature':
 * @property integer $id
 * @property integer $no_of_lubricating_bay
 * @property integer $no_of_wash_rack
 * @property integer $crank_case_drainage_provided
 * @property integer $oil_or_water_separator_provided
 * @property integer $perimeter_or_wall_provided
 * @property string $height
 * @property string $units_of_measurement_of_the_height
 * @property integer $any_opening
 * @property integer $dispensing_platform_provided
 * @property integer $height_within_limit
 * @property string $manhole_tank_made_of
 * @property string $thickness
 * @property integer $gasketed
 * @property string $housekeeping
 * @property integer $any_refreshment_stand_being_operated_inside_premises
 * @property integer $inspection_id
 *
 * The followings are the available model relations:
 * @property Inspection $inspection
 */
class OtherSafetyFeature extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return OtherSafetyFeature the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}
const a = "Poor";
const b ="Good";
public function getHousekeeping(){
return array(
self::a=>"Poor",
self::b=>"Good"
);


}

const c = "Foot";
const d ="Inches";
public function getMeasurement(){
return array(
self::c=>"Foot",
self::d=>"Inches"
);


}
	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'other_safety_feature';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('inspection_id', 'required'),
			array('no_of_lubricating_bay, no_of_wash_rack, crank_case_drainage_provided, oil_or_water_separator_provided, perimeter_or_wall_provided, any_opening, dispensing_platform_provided, height_within_limit, gasketed, any_refreshment_stand_being_operated_inside_premises, inspection_id', 'numerical', 'integerOnly'=>true),
			array('height', 'length', 'max'=>11),
			array('units_of_measurement_of_the_height', 'length', 'max'=>6),
			array('housekeeping', 'length', 'max'=>4),
			array('manhole_tank_made_of, thickness', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, no_of_lubricating_bay, no_of_wash_rack, crank_case_drainage_provided, oil_or_water_separator_provided, perimeter_or_wall_provided, height, units_of_measurement_of_the_height, any_opening, dispensing_platform_provided, height_within_limit, manhole_tank_made_of, thickness, gasketed, housekeeping, any_refreshment_stand_being_operated_inside_premises, inspection_id', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'inspection' => array(self::BELONGS_TO, 'Inspection', 'inspection_id'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'no_of_lubricating_bay' => 'No Of Lubricating Bay',
			'no_of_wash_rack' => 'No Of Wash Rack',
			'crank_case_drainage_provided' => 'Crank Case Drainage Provided',
			'oil_or_water_separator_provided' => 'Oil Or Water Separator Provided',
			'perimeter_or_wall_provided' => 'Perimeter Or Wall Provided',
			'height' => 'Height',
			'units_of_measurement_of_the_height' => 'Units Of Measurement Of The Height',
			'any_opening' => 'Any Opening',
			'dispensing_platform_provided' => 'Dispensing Platform Provided',
			'height_within_limit' => 'Height Within Limit',
			'manhole_tank_made_of' => 'Manhole Tank Made Of',
			'thickness' => 'Thickness',
			'gasketed' => 'Gasketed',
			'housekeeping' => 'Housekeeping',
			'any_refreshment_stand_being_operated_inside_premises' => 'Any Refreshment Stand Being Operated Inside Premises',
			'inspection_id' => 'Inspection',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('no_of_lubricating_bay',$this->no_of_lubricating_bay);
		$criteria->compare('no_of_wash_rack',$this->no_of_wash_rack);
		$criteria->compare('crank_case_drainage_provided',$this->crank_case_drainage_provided);
		$criteria->compare('oil_or_water_separator_provided',$this->oil_or_water_separator_provided);
		$criteria->compare('perimeter_or_wall_provided',$this->perimeter_or_wall_provided);
		$criteria->compare('height',$this->height,true);
		$criteria->compare('units_of_measurement_of_the_height',$this->units_of_measurement_of_the_height,true);
		$criteria->compare('any_opening',$this->any_opening);
		$criteria->compare('dispensing_platform_provided',$this->dispensing_platform_provided);
		$criteria->compare('height_within_limit',$this->height_within_limit);
		$criteria->compare('manhole_tank_made_of',$this->manhole_tank_made_of,true);
		$criteria->compare('thickness',$this->thickness,true);
		$criteria->compare('gasketed',$this->gasketed);
		$criteria->compare('housekeeping',$this->housekeeping,true);
		$criteria->compare('any_refreshment_stand_being_operated_inside_premises',$this->any_refreshment_stand_being_operated_inside_premises);
		$criteria->compare('inspection_id',$this->inspection_id);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}